<!-- 当前模块：修改手机号 -->
<template>
  <div class="page_setPhone">
    <van-field label="手机号" type="number" maxlength="11" title-width="80px" v-model="newPhone" placeholder="请输入手机号" @input="inputChange"></van-field>
    <div class="bottom12"></div>
    <van-button type="info" size="default" block round @click="handleSubmit">提交</van-button>
  </div>
</template>

<script>

export default {
  data () {
    return {
      newPhone: ""
    }
  },
  methods: {
    inputChange({mp}) {
      this.newPhone = mp.detail;
    },
    /**提交按钮事件 */
    handleSubmit() {
      const reg = /^1(3|5|7|8|9)[0-9]{9,9}$/g;
      if(reg.test(this.newPhone)) {

      } else {
        wx.showToast({
          title: "手机号不合法",
          icon: "none"
        })
        return;
      }
    }
  },

  onPullDownRefresh() {
    wx.startPullDownRefresh({
      complete: () => {
        wx.stopPullDownRefresh();
      }
    })
  },
  onShareAppMessage() {
    return {
      title: '智慧养老',
      path: '/pages/auth/main',
      from: "menu" 
    }
  },
}
</script>

<style>
.page_setPhone {
  height: calc(100vh - 56px);
  padding: 24rpx;
  background: #f5f5f5;
}
</style>
